package com.gitee.sop.layui.adminserver.entrance.manager;

import com.gitee.sop.layui.adminserver.entrance.bo.ServiceContext;

/**
 * 业务上下文对象保存者
 *
 * @author: huwei
 * @date: 2020/4/1 10:17
 * @version: 1.0.0
 */
public class ServiceContextHolder {

    private static final ThreadLocal<ServiceContext> container = new InheritableThreadLocal<>();

    public static ServiceContext getContext() {
        return container.get();
    }

    public static void setContext(ServiceContext serviceContext) {
        container.set(serviceContext);
    }

    public static void clear() {
        container.remove();
    }
}
